package com.free.mini.admin.controller;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.free.mini.common.base.ResultData;
import com.free.mini.core.server.api.BannerConfigApi;
import com.free.mini.core.server.vo.req.BannerConfigCreateReqVO;
import com.free.mini.core.server.vo.req.BannerConfigDelReqVO;
import com.free.mini.core.server.vo.req.BannerConfigQueryReqVO;
import com.free.mini.core.server.vo.req.BannerConfigUpdateReqVO;
import com.free.mini.core.server.vo.resp.BannerConfigQueryRespVO;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * banner Controller
 *
 * @author dongsufeng
 * @date 2023-08-22 15:17:42
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("api/admin/banner/v1/")
public class BannerConfigController {

    private final BannerConfigApi bannerConfigApi;


    @PostMapping("page")
    public ResultData<Page<BannerConfigQueryRespVO>> bannerConfigList(@RequestBody @Validated BannerConfigQueryReqVO reqVO) {
        return bannerConfigApi.bannerConfigList(reqVO);
    }

    @PostMapping("add")
    public ResultData<Boolean> addBannerConfig(@RequestBody @Validated BannerConfigCreateReqVO reqVO) {
        return bannerConfigApi.addBannerConfig(reqVO);
    }

    @PostMapping("del")
    public ResultData deleteBannerConfig(@RequestBody @Validated BannerConfigDelReqVO reqVO) {
        return bannerConfigApi.deleteBannerConfig(reqVO);
    }

    @PostMapping("update")
    public ResultData updateBannerConfig(@RequestBody @Validated BannerConfigUpdateReqVO reqVO) {
        return bannerConfigApi.updateBannerConfig(reqVO);
    }
}
